<?php 
require_once ('paths.php');
require_once (CONFIG.'config.php');
require (INCLUDES.'authentication_nav.inc.php');  session_start(); 
require (INCLUDES.'url_variables.inc.php');
require (DB.'general.db.php');
include (LIB.'general.lib.php');
//include (INCLUDES.'version.inc.php');
//include (INCLUDES.'headers.inc.php');
$today = date('Y-m-d');

$query_author = sprintf("SELECT * FROM users WHERE id='%s'", $row_courses['aid']); 
$author = mysql_query($query_author, $connection) or die(mysql_error());
$row_author = mysql_fetch_assoc($author);

$query_cpd_latest = "SELECT * FROM course_project WHERE cid='$cid' ORDER BY vid DESC"; 
$cpd_latest = mysql_query($query_cpd_latest, $connection) or die(mysql_error());
$row_cpd_latest = mysql_fetch_assoc($cpd_latest);
$totalRows_cpd_latest = mysql_num_rows($cpd_latest);

if ($action == "export") {
	if ($go == "module") 		$title = $row_courses['jiu_course_id']."_Module".$mid;
	elseif ($go == "home") 		$title = $row_courses['jiu_course_id']."_Home";
	elseif ($go == "syllabus") 	$title = $row_courses['jiu_course_id']."_Syllabus"; 
	elseif ($go == "project") 	$title = $row_courses['jiu_course_id']."_Project";
	elseif ($go == "proposal") 	$title = $row_courses['jiu_course_id']."_Proposal";
	else $title = "";
	header("Content-Type: application/msword;"); 
	header("Content-Disposition: attachment; filename=".$title.".doc");
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JIU Template</title>
<link href="css/export.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body <?php if ($action == "print") echo "onload=\"javascript:window.print()\""; ?>>
<?php 
	if ($go == "module") 	include (SECTIONS.'export_module.sec.php');
	if ($go == "home") 		include (SECTIONS.'export_home.sec.php'); 
	if ($go == "syllabus") 	include (SECTIONS.'export_syllabus.sec.php'); 
	if ($go == "project") 	include (SECTIONS.'export_project.sec.php'); 
	if ($go == "proposal") 	include (SECTIONS.'export_proposal.sec.php'); 
?>
</body>
</html>
